﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace Clipping.Utils
{
    public class BoolVisibilityConverter: IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool? valueBool = value as bool?;
            if (valueBool == null)
            {
                return Visibility.Collapsed;
            }
            else 
            {
                if (valueBool == true && parameter.ToString () == "True")
                    return Visibility.Visible;
                else if (valueBool == false && parameter.ToString() == "False")
                    return Visibility.Visible;
                else
                    return Visibility.Collapsed;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
